import request, { get, post, put } from '@/utils/request'

// 商家注册
export function registerMerchant(data) {
  return request({
    url: '/merchant/register',
    method: 'post',
    data
  })
}

// 获取商家信息
export function getMerchantInfo() {
  return request({
    url: '/merchant/info',
    method: 'get'
  })
}

// 更新商家信息
export function updateMerchantInfo(data) {
  return request({
    url: '/merchant/info',
    method: 'put',
    data
  })
}

// 提交商家认证
export function submitCertification(data) {
  return request({
    url: '/merchant/certification',
    method: 'post',
    data
  })
}

// 获取认证信息
export function getCertificationInfo() {
  return request({
    url: '/merchant/certification',
    method: 'get'
  })
}

// 修改密码
export function updatePassword(data) {
  return request({
    url: '/merchant/password',
    method: 'put',
    data
  })
}

// 修改手机号
export function updatePhone(data) {
  return request({
    url: '/merchant/phone',
    method: 'put',
    data
  })
}

// 修改邮箱
export function updateEmail(data) {
  return request({
    url: '/merchant/email',
    method: 'put',
    data
  })
}

// 上传文件
export function uploadFile(data) {
  return request({
    url: '/upload',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data
  })
}

// 获取地区数据
export function getRegionData() {
  return request({
    url: '/region/list',
    method: 'get'
  })
}

// 获取商家状态
export function getMerchantStatus() {
  return request({
    url: '/merchant/status',
    method: 'get'
  })
}

// 发送手机验证码
export function sendVerificationCode(phone) {
  return request({
    url: '/merchant/send-code',
    method: 'post',
    data: { phone }
  })
}

// 验证手机验证码
export function verifyCode(phone, code) {
  return request({
    url: '/merchant/verify-code',
    method: 'post',
    data: { phone, code }
  })
}

// 更新商家设置
export function updateMerchantSettings(data) {
  return request({
    url: '/merchant/settings',
    method: 'put',
    data
  })
}

// 获取商家设置
export function getMerchantSettings() {
  return request({
    url: '/merchant/settings',
    method: 'get'
  })
}

// 获取洗护服务类型
export function getLaundryServiceTypes() {
  return request({
    url: '/merchant/service-types',
    method: 'get'
  })
}